<?php
/**
 * 个推消息推送 
 */
class Cli_GetuimsgController extends Ctrl_Cli{
	public function indexAction(){
		while(true){
            $tTime = time();
            $tRunlogdir = APPLICATION_PATH . '/shell/runlog/cli_getuimsg.run';
            Tool_Fnc::writefile($tRunlogdir , $tTime);

			$this->sent();
			sleep(1);
		}
		exit;
	}
	private function sent(){
		$tRedis = Cache_Redis::instance();
		$tRes = $tRedis->rpop('supeibao_getui');	
		if(empty($tRes)){return ;}
		$tRow = unserialize($tRes);
		
		$tUrl = Yaf_Registry::get("config")->web->url->getui.'/getui?cid='.$tRow['cid'].'&title='.$tRow['title'].'&content='.$tRow['content'].'&devicetoken=' . $tRow['devicetoken'].'&type='.$tRow['type'].'&id='.$tRow['id'];
        echo $tUrl;
		file_get_contents($tUrl);
	}
}
